<?php

require_once 'PHPCR/NodeIterator.php';
require_once 'PHPCR/query/RowIterator.php';
require_once 'PHPCR/RepositoryException.php';


/**
 * A QueryResult object. Returned in an iterator by query.Query#execute()
 * Query.execute()
 *
 * @package phpcr
 * @subpackage query
 */
interface phpCr_Query_Result
{
    /**
     * Returns an array of all the property names (column names) in this result set.
     *
     * @return array of strings
     * @throws RepositoryException if an error occurs.
     */
    public function getColumnNames();

    /**
     * Returns an iterator over the <code>Row</code>s of the query result table.
     * If an <code>ORDER BY</code> clause was specified in the query, then the
     * order of the returned properties in the iterator will reflect the order
     * specified in that clause. If no items match, an empty iterator is returned.
     *
     * @return a <code>RowIterator</code>
     * @throws RepositoryException if an error occurs.
     */
    public function getRows();

    /**
     * Returns an iterator over all nodes that match the query. If an <code>ORDER BY</code>
     * clause was specified in the query, then the order of the returned nodes in the iterator
     * will reflect the order specified in that clause. If no nodes match, an empty iterator
     * is returned.
     *
     * @return a <code>NodeIterator</code>
     * @throws RepositoryException if an error occurs.
     */
    public function getNodes();
}
